<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>发送视频</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<script src="../../js/flexible.min.js"></script>
		<style>
			html,
			body {
				width: 100%;
				height: 100%;
				background: #e4e4e4;
			}
			
			.mui-content {
				width: 100%;
				height: 100%;
				padding-top: 2.066666rem;
				position: relative;
				background: #e4e4e4;
			}
			
			.people-img {
				margin: 0 auto;
				text-align: center;
			}
			
			.people-img img {
				width: 3.466666rem;
				height: 3.466666rem;
				border-radius: 100%;
				border: 1px solid #FD698D;
			}
			
			.people-name {
				color: #000;
				font-size: 0.453333rem;
				margin-bottom: 0;
				margin: 0.4rem 0 0.56rem 0;
			}
			
			.people-wait {
				font-size: 0.453333rem;
			}
			
			.hua {
				position: fixed;
				bottom: 15%;
				width: 100%;
				display: flex;
				padding: 0 0.426666rem;
				justify-content: space-around;
			}
			
			.hua-button {
				width: 3.125rem;
				height: 1.25rem;
			}
			
			.lvse {
				color: #1ce83f;
				margin-top: 30px;
				font-size: 0.3rem;
			}
			
			.yaoqing {
				font-size: 0.48rem;
				font-family: "微软雅黑";
				color: #000;
				margin-bottom: 0;
				margin-top: 1.173333rem;
				text-align: center;
			}
		</style>
	</head>

	<body>
		<div class="mui-content">
			<div class="people-img">
				<img id="per_img" src="../../img/function/Blog_vipkejian.png" alt="" />
				<p class="people-name">昵称</p>
				<p class="people-wait">来自<span id="per_name">昵称</span>的语音邀请</p>
			</div>
			<p style="display: none;" class="yaoqing">请正在等待对方接听...</p>
			<div class="hua">
				<div class="hua-left">
					<img id="jie" src="../../img/hello/tyjt_03.png" alt="" class="hua-button hua-jiet" />
				</div>
				<div class="hua-right">
					<img id="close" src="../../img/hello/tygd_03_03.png" alt="" class="hua-button hua-guad" />
				</div>
			</div>
		</div>
		<audio id="audio" loop="loop">'
			<source src="audio/b.mp3" type="audio/mpeg"></source>
			<source src="audio/b.mp3" type="audio/ogg"></source>
		</audio>
		<audio id="audio2">'
			<source src="audio/c.mp3" type="audio/mpeg"></source>
			<source src="audio/c.mp3" type="audio/ogg"></source>
		</audio>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/function.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui.plusReady(function() {
				var self = plus.webview.currentWebview();
				var name = self.name;
				var headimg = self.headimg;
				var type = self.type;
				document.getElementsByClassName("people-name")[0].innerHTML = name;
				document.getElementById("per_img").setAttribute('src', headimg);
				plus.device.vibrate(2000);
				var music = document.getElementById("audio");
				var music2 = document.getElementById("audio2");
				music.play();
				var b = random_x(2, 6);
				//				var coin = isvipcoin(1);
				var ws = plus.webview.currentWebview();
				mui.back = function() {
					music.pause();
					plus.webview.currentWebview().close()
				};
				if(type == "call") {
					callMM()
				} else {
					MMcall();
				}

				function callMM() {
					var num = parseInt(Math.random() * 4);
					if(num == 1) {
						setTimeout(function() {
							music.pause();
							music2.play();
							mui.toast('无应答');
							mui.back()
						}, 30000)
					} else if(num == 2) {
						setTimeout(function() {
							music.pause();
							music2.play();
							mui.toast('对方已挂断');
							mui.back()
						}, b * 1000)
					} else {
						if(!coin) {
							setTimeout(function() {
								mui.toast('帐户余额不足无法通话，请充值！');
								document.getElementsByClassName("people-wait")[0].innerHTML = '对方已同意接听…';
								document.getElementsByClassName("people-wait")[0].classList.add('lvse')
								muiback()
							}, b * 1000 + 5000)
						} else {
							num = parseInt(Math.random() * 2);
							if(num == 1) {
								setTimeout(function() {
									music.pause();
									music2.play();
									mui.toast('无人接听');
									mui.back()
								}, 30000)
							} else {
								setTimeout(function() {
									music.pause();
									music2.play();
									mui.toast('对方已挂断');
									mui.back()
								}, b * 1000)
							}
						}
					}
				}

				function MMcall() {
					setTimeout(function() {
						mui.toast('对方已挂断');
						music.pause();
						music2.play();
						setTimeout(function() {
							mui.back()
						}, 1000)
					}, 40000);
				}

				function random_x(min, max) {
					return Math.floor(min + Math.random() * (max - min))
				}

				function muiback() {
					music.pause();
					music2.play();
					setTimeout(function() {
						openWallet('wallet.html',1)
						setTimeout(function() {
							plus.webview.close(ws, "none")
						}, 1000)
					}, 2000);
					document.getElementsByClassName("guaduan-p").innerHTML = '返回';
				}

				document.getElementsByClassName("guaduan")[0].addEventListener('tap', function() {
					mui.toast('已取消！')
					music.pause();
					music2.play();
					setTimeout(function() {
						mui.back()
					}, 1000)
				})
			});
		</script>
	</body>

</html>